import React from "react";
import { Space, Button } from "antd";


/**@description 列表表格字段 */
const getColumns = ({ open = Function, handleDelete = Function, download = Function }) => {
    const columns = [
        {
            title: "添加时间",
            key: "createDate",
            dataIndex: "createDate",
            width: 180,
            type: "Date", // 日期格式化
        },
        {
            title: "页面名称",
            key: "title",
            dataIndex: "title",
            width: 180,
        },
        {
            title: "备注",
            key: "remark",
            dataIndex: "remark",
            width: 380,
        },
        {
            title: "操作",
            key: "action",
            dataIndex: "action",
            width: 280,
            render: (text, record) => {
                return <Space>
                    <Button type="link" onClick={() => open({ type: "update", record: record })}>修改</Button>
                    <Button type="link" onClick={() => download({ type: "download", record: record })}>生成代码</Button>
                    <Button type="link" danger onClick={() => handleDelete(record)}>删除配置</Button>
                </Space>
            }
        }
    ];
    // console.log("代码生成的columns:\n", columns)
    return columns;
}

export default getColumns;